package cn.tedu.front.search.dao.search;

import cn.tedu.front.search.pojo.po.CompanyPO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Highlight;
import org.springframework.data.elasticsearch.annotations.HighlightField;
import org.springframework.data.elasticsearch.annotations.HighlightParameters;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.core.SearchPage;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface ICompanyCustomSearchRepository extends ElasticsearchRepository<CompanyPO,Long> {


@Query("{\n" +
        "    \"bool\": {\n" +
        "      \"should\": [\n" +
        "        {\n" +
        "          \"match\": {\n" +
        "            \"keyword\": \"?0\"\n" +
        "          }\n" +
        "        },\n" +
        "        {\n" +
        "          \"match\": {\n" +
        "            \"companyName\": \"?0\"\n" +
        "          }\n" +
        "        },\n" +
        "        {\n" +
        "          \"match\": {\n" +
        "            \"companyPosition\": \"?0\"\n" +
        "          }\n" +
        "        }\n" +
        "\n" +
        "      ]\n" +
        "    }\n" +
        "  }")
    SearchPage<CompanyPO> customSearchCompanyPO(String keyword, Pageable pageable);
}
